package com.qingzhuge.scheduler.enums;

import com.qingzhuge.common.IBaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author : zero.xiao
 * @description :
 * @date :2019-05-17 14:26
 * @modified :
 */
@ApiModel("任务作业类型")
public enum JobType implements IBaseEnum<String> {
    /**非阻塞*/
    @ApiModelProperty("并行")
    parallel("parallel"),
    /**阻塞*/
    @ApiModelProperty("串行")
    serial("serial");
    private String value;

    JobType(String value) {
        this.value = value;
    }

    @Override
    public String value() {
        return value;
    }

    public static JobType get(String name) {
        if (name == null) {
            return null;
        }
        JobType[] vals = JobType.values();
        for (JobType e : vals) {
            boolean b = e.name().equals(name);
            if (b) {
                return JobType.valueOf(name);
            }
        }
        return null;
    }
}
